package com.nut.lmsc.api.sys;

import com.nut.lmsc.common.Result;
import com.nut.lmsc.entity.AdapayBankCode;
import com.nut.lmsc.entity.AdapayRegion;
import com.nut.lmsc.service.AdapayBankCodeService;
import com.nut.lmsc.service.AdapayRegionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/adapay")
public class AdapayController {

    @Autowired
    private AdapayBankCodeService adapayBankCodeService;

    @Autowired
    private AdapayRegionService adapayRegionService;

    @GetMapping("/region")
    public Result<List<AdapayRegion>> region(@RequestParam Integer pid) {
        return adapayRegionService.list(pid);
    }

    @GetMapping("/bankCode")
    public Result<List<AdapayBankCode>> region(@RequestParam(required = false) String name) {
        return adapayBankCodeService.list(name);
    }

}